#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main()
{
    int n = 0;
    char arr[20], a1, a2, a3, a4;
    scanf("%d %c %c %c %c", &n, &a1, &a2, &a3, &a4);
    getchar();
    for (int i = 0; i < n; i++)
    {
        scanf("%c", &arr[i]);
    }
    for (int i = 0; i < n; i++)
    {
        if (arr[i] == a1)
        {
            arr[i] = a2;
        }
        if (arr[i] == a3)
        {
            arr[i] = a4;
        }
        printf("%c", arr[i]);
    }
    return 0;
}